package thread;

import java.util.LinkedList;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;

public class MyCallable implements Callable<String> {
    
    private int n;

    public MyCallable(int n) {
        this.n = n;
    }

    @Override
    public String call() throws Exception {
        Thread thread = Thread.currentThread();
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            System.out.println("子线程 " + thread.getName() + "  " +i);
            sum += i;
            
        }
        return thread.getName() + " answer " + sum;
    }
}
